#include <format>
#include <iostream>

#include "lib/rect.h"

Rect Rect::_new(int w, int h)
{
    Rect self;

    self.w = w;
    self.h = h;

    return self;
}

std::string Rect::display()
{
    return std::format("A {{ w: {}, h: {} }}", this->w, this->h);
}

std::ostream &operator<<(std::ostream &out, Rect &self)
{
    return out << self.display();
}

void Rect::set_w(int value)
{
    this->w = value;
}

void Rect::set_h(int value)
{
    this->h = value;
}

int Rect::area()
{
    return this->w * this->h;
}